package com.knowledge.business.controller;

import com.knowledge.common.core.domain.AjaxResult;
import dev.langchain4j.model.openai.OpenAiChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: zhaoyongke
 * @create: 2025-09-09 10:32
 * @description: testSpringBoot
 */
@RestController
@RequestMapping("/business/ai")
public class AiController {

    @Autowired
    private OpenAiChatModel openAiChatModel;

   /**
   *
   * 对话
   */
    @RequestMapping("/chat")
    public AjaxResult chat(String   message) {
          String answer = openAiChatModel.chat(message);
           System.out.println(answer);
            return  AjaxResult.success(answer);
    }


}
